package com.nhh.v.mapper;

import com.nhh.v.model.NhhwakTowns;
import org.apache.ibatis.annotations.Param;
import com.nhh.v.model.NhhwakUsers;
import com.nhh.v.model.TownUserInfo;
import tk.mybatis.mapper.common.Mapper;

import java.math.BigDecimal;
import java.util.List;

public interface NhhwakTownsMapper extends Mapper<NhhwakTowns> {

    String selectTownNameById(String townId);

    Long updateTempHashRateByUserId(Integer uid, Long hashRate);

    NhhwakTowns selectTownById(Integer townId);

    NhhwakUsers selectMyTown(Integer uid);

    Long selectTownUserCount(Integer townId);

    List<NhhwakTowns> selectTowns(Integer order, Integer pIndex, Integer psize, Integer townHashratecoef);

    List<TownUserInfo> selectTownUsers(Integer townId, Integer townHashRate, Integer pIndex, Integer pSize);

    Integer createTown(NhhwakTowns town);

    Long subUserCoins(Integer uid, BigDecimal consumeNhhcoins, Integer townId);

    Long updateTownByTownId(Integer townId, String name, String logo, String description);

    Long updateUserTownByUid(Integer uid, Integer townId);

    Long updateUserTownCount(Integer townId, Integer num);

    Long exitTown(Integer uid);

    Long dismissTown(Integer townId);
    Long updateTempHashRateByUserId(@Param("userId") Integer userId, @Param("hashRate") Long hashRate);

    Long selectTownUserNumById(Integer townId);
}